package icu.d4peng.basic.http.feign;

import feign.Capability;
import feign.InvocationHandlerFactory;

import org.springframework.cache.interceptor.CacheInterceptor;

/**
 * @author d4peng d4peng@qq.com
 * @date 2023-11-26 15:36:16
 */
public class CachingCapability implements Capability {

	private final CacheInterceptor cacheInterceptor;

	public CachingCapability(CacheInterceptor cacheInterceptor) {
		this.cacheInterceptor = cacheInterceptor;
	}

	@Override
	public InvocationHandlerFactory enrich(InvocationHandlerFactory invocationHandlerFactory) {
		return new FeignCachingInvocationHandlerFactory(invocationHandlerFactory, cacheInterceptor);
	}

}
